<?
@set_time_limit(0); 
@ini_set('memory_limit', '128M');
require_once("includes/config.php");
require_once("includes/mysql.php");
require_once("includes/rsspost.php");

$q=query("select * from rssfeed where enable=1 order by lasttime asc");
echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';

while($rss=fetch($q))
{
	$data=array();
	if($rss["type"]==1)
		$data=ngoisaovn($rss);
	elseif($rss["type"]==2)
		$data=ngoisaonet($rss);
	if(count($data)>0)
	foreach($data as $post)
		{
			addpost($post,$rss["menuid"],$rss["id"]);
			update(array("lasttime"=>$post["pubDate"]),"rssfeed","id=$rss[id] and lasttime < $post[pubDate]");
		}
}
echo "ok";
?>